package com.qumitech.visualnovel.datasource.editor;

import java.util.*;
import com.qumitech.visualnovel.model.dto.BookNumberDTO;
import com.qumitech.visualnovel.model.dao.editor.ChapterDAO;
import org.apache.ibatis.annotations.*;

public interface ChapterDAOMapper {
    int deleteByPrimaryKey(Long id);

    int insert(ChapterDAO record);

    int insertSelective(ChapterDAO record);

    ChapterDAO selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(ChapterDAO record);

    int updateByPrimaryKey(ChapterDAO record);

    Integer getReviewStateNum(@Param("bookId") Long bookId, @Param("reviewState") String reviewState);

    ChapterDAO getChapter(@Param("bookId") Long bookId, @Param("index") Integer index);

    List<ChapterDAO> listByReviewState(
        @Param("bookId") Long bookId,
        @Param("reviewState") String reviewState,
        @Param("orderBy") String orderBy,
        @Param("orderType") String orderType);

    int totalChapters(Long bookId);

    int freeChapters(Long bookId);

    int totalWords(Long bookId);

    int totalPrice(Long bookId);

    List<ChapterDAO> getPublishTask();

    @MapKey("id")
    Map<Long, BookNumberDTO> getTotalChapterMap(@Param("bookIdList") List<Long> bookIdList);

    @MapKey("key")
    Map<String, BookNumberDTO> getTotalFrameMap(@Param("bookIdList") List<Long> bookIdList);
}